import request from '@/request'

export function getAllCategorys() {
  return request({
    url: '/categorys',
    method: 'get',
  })
}

export function getAllCategorysDetail() {
  return request({
    url: '/categorys/detail',
    method: 'get',
  })
}

export function getCategory(id) {
  return request({
    url: `/categorys/${id}`,
    method: 'get',
  })
}

export function getCategoryDetail(id) {
  return request({
    url: `/categorys/detail/${id}`,
    method: 'get',
  })
}

export function categoryAll(query) {
    return request({
      url: '/categorys/categoryAll',
      method: 'post',
      data: {
        pageNo: query.pageNo,
        pageSize: query.pageSize,
        categoryName: query.categoryName,
        description: query.description,
      },

    })
}

export function deleteCategoryById(id) {
    return request({
      url: `/categorys/deleteCategoryById/${id}`,
      method: 'post',
    })
  }

export function updateCategory(category) {
    return request({
      url: '/categorys/UpdateCategory',
      method: 'post',
      data: category,
    })
  }

export function addCategory(category) {
    return request({
      url: '/categorys/addCategory',
      method: 'post',
      data: category,
    })
  }


